<?php
namespace Home\Controller;

use Common\Controller\HomebaseController;

class FeedbackController extends HomebaseController
{
    public function __construct()
    {
        parent::__construct();
        $this->siteOption = get_site_options();
    }
    public function index(){
        //print_r($this->siteOption);
    }
    /**
     * 评论
     */
    public function post()
    {
        $post['name'] = I("post.name");
        $post['tel'] = I("post.tel");
        $post['web_type'] = I("post.web_type");
        $post['budget'] = I("post.budget");
        $post['demand'] = I("post.demand");
        $post['ip'] = get_client_ip();
        $post['created_time'] = date('Y-m-d H:i:s');
        if(!sp_check_verify_code()){
            //$this->error(L('CAPTCHA_NOT_RIGHT'));
        }
        if (empty($post['name'])) {
            $this->error("请输入姓名！");
        } else if (empty($post['tel'])) {
            $this->error("请输入联系电话！");
        }
        $model = M("feedback");
        $result = $model->add($post);
        if($result){
            $this->success('提交成功，稍后将有工作人员和你联系！');
        }else{
            $this->error('提交失败，请重试！');
        }
    }
}